import os,sys

dirname, basename = os.path.split(r"E:\mycode\other\123.jpg")
print dirname,"---",basename

root, extension = os.path.splitext(basename)
print root,"---",extension

